package com.health.tools;

import com.nova.source.R;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

public class ResultTextDialog {
	private Dialog mDialog;
	private TextView mTextView;
	private Context context;

	public ResultTextDialog(Context context) {
		this.mDialog = new Dialog(context, R.style.dialog);
		LayoutInflater inflater = LayoutInflater.from(context);
		this.context = context;
		View view = inflater.inflate(R.layout.dialog_text, null);
		this.mTextView = ((TextView) view.findViewById(R.id.textview));
		this.mTextView.setTextColor(Color.BLACK);
		this.mDialog.setCancelable(false);
		this.mDialog.setContentView(view);
	}

	public void  setText(String text) {
		this.mTextView.setText(text);
	}

	public void setText(int textID) {
		this.mTextView.setText(textID);
	}

	public void cancel() {
		this.mDialog.cancel();
	}

	public void show(String str) {
		this.mTextView.setText(str);
		this.mDialog.show();
	}

	public void show() {
		this.mDialog.show();
	}


	public void showCancleLong() {
		this.mDialog.show();
		this.mTextView.postDelayed(this.cancelRunnable, 3500L);
	}


	public void showCancleShort() {

		this.mDialog.show();
		this.mTextView.postDelayed(this.cancelRunnable, 2000L);
	}

	private Runnable cancelRunnable = new Runnable() {
		public void run() {
			ResultTextDialog.this.cancel();
		}
	};
}
